﻿using System.Windows;
using Microsoft.Surface.Presentation.Manipulations;

namespace Black.SurfaceToolkit.Controls
{
    /// <summary>
    /// Données pour les événements routés <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterViewItem.InertiaCompleted" />, <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterViewItem.ManipulationCompleted" />, <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterViewItem.AllOperationCompleted" />, <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterView.InertiaCompleted" />, <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterView.ManipulationCompleted" /> et <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterView.AllOperationCompleted" />.
    /// </summary>
    public class OperationCompletedRoutedEventArgs : RoutedEventArgs
    {
        #region Accesseurs

        /// <summary>
        /// Retoune la vélocité angulaire.
        /// </summary>
        public double AngularVelocity
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la vélocité de l'expension.
        /// </summary>
        public double ExpansionVelocity
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient l'origine de la manipulation.
        /// </summary>
        public Point ManipulationOrigin
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient l'expension totale
        /// </summary>
        public double TotalExpansion
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la rotation totale.
        /// </summary>
        public double TotalRotation
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient l'agrandissement total.
        /// </summary>
        public double TotalScale
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient le déplacement total.
        /// </summary>
        public Vector TotalTranslation
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la vélocité.
        /// </summary>
        public Vector Velocity
        {
            get;
            private set;
        }

        #endregion

        #region Constructeurs

        /// <summary>
        /// Initialise une nouvelle instance de <see cref="T:Black.SurfaceToolkit.Controls.OperationCompletedRoutedEventArgs" />.
        /// </summary>
        /// <param name="p_oOperation">Source d'information.</param>
        public OperationCompletedRoutedEventArgs(Affine2DOperationCompletedEventArgs p_oOperation)
            : base()
        {
            this.InitializeInstance(p_oOperation);
        }

        /// <summary>
        /// Initialise une nouvelle instance de <see cref="T:Black.SurfaceToolkit.Controls.OperationCompletedRoutedEventArgs" />.
        /// </summary>
        /// <param name="p_oEvent">Evénement routé associé.</param>
        /// <param name="p_oOperation">Source d'information.</param>
        public OperationCompletedRoutedEventArgs(RoutedEvent p_oEvent, Affine2DOperationCompletedEventArgs p_oOperation)
            : base(p_oEvent)
        {
            this.InitializeInstance(p_oOperation);
        }

        /// <summary>
        /// Initialise une nouvelle instance de <see cref="T:Black.SurfaceToolkit.Controls.OperationCompletedRoutedEventArgs" />.
        /// </summary>
        /// <param name="p_oEvent">Evénement routé associé.</param>
        /// <param name="p_oSource">Source de l'événement.</param>
        /// <param name="p_oOperation">Source d'information.</param>
        public OperationCompletedRoutedEventArgs(RoutedEvent p_oEvent, object p_oSource, Affine2DOperationCompletedEventArgs p_oOperation)
            : base(p_oEvent, p_oSource)
        {
            this.InitializeInstance(p_oOperation);
        }

        #endregion

        #region Fonctions privées

        /// <summary>
        /// Initialise l'instance à partir des informations spécifiées.
        /// </summary>
        /// <param name="p_oOperation">Source d'information.</param>
        private void InitializeInstance(Affine2DOperationCompletedEventArgs p_oOperation)
        {
            this.AngularVelocity = p_oOperation.AngularVelocity;
            this.ExpansionVelocity = p_oOperation.ExpansionVelocity;
            this.ManipulationOrigin = p_oOperation.ManipulationOrigin;
            this.TotalExpansion = p_oOperation.TotalExpansion;
            this.TotalRotation = p_oOperation.TotalRotation;
            this.TotalScale = p_oOperation.TotalScale;
            this.TotalTranslation = p_oOperation.TotalTranslation;
            this.Velocity = p_oOperation.Velocity;
        }

        #endregion
    }
}
